(define cidade "Atlantis")
(string-ref cidade 3)
(string-length "Abracadabra")
(define fala-de-hamlet "That skull had a tongue in it")
(string=? fala-de-hamlet "That skull had a tongue in it")
(string=? fala-de-hamlet "That skull had a TONGUE in it")
(string-ci=? fala-de-hamlet "That skull had a TONGUE in it")
(string-append "A " "terra " "é " "azul!")
(string->symbol "transforme-me")
(symbol->string 'quero-ser-uma-string)

(define string-map
  (lambda (proc s)
    (let ((l (string->list s)))
      (let ((new-list (map proc l)))
        (list->string new-list)))))

(define string-upcase
  (lambda (s)
    (string-map char-upcase s)))

(string-upcase "Maria de João")

;;implementação da cifra de césar
(define char->caesar-idx
  (lambda (x)
    (let ((a (char->integer #\A)))
      (- (char->integer x) a))))

(define caesar-idx->char
  (lambda (x)
    (let ((a (char->integer #\A)))
      (let ((b (+ x a)))
        (integer->char b)))))

(char->caesar-idx #\B)

(define caesar-translate-char
  (lambda (c k)
    (caesar-idx->char (modulo (+ (char->caesar-idx c)
                                 k)
                              26))))
(caesar-translate-char #\B 10)

;;decifrando
(caesar-translate-char #\L -10)

;;aplicando em frases:
;; 
(define caesar-encrypt
  (lambda (s)
    (let ((caesar-enc-10 (lambda (c)
                           (caesar-translate-char c 10))))
      (string-map caesar-enc-10
                  (string-upcase s)))))

(define caesar-decrypt
  (lambda (s)
    (let ((caesar-dec-10 (lambda (c)
                           (caesar-translate-char c -10))))
      (string-map caesar-dec-10
                  (string-upcase s)))))

(caesar-encrypt "mensagem secreta")
(caesar-decrypt "WOXCKQOWDCOMBODK")